#!/bin/bash

echo "启动Docker MySQL服务..."
echo ""

# 切换到脚本所在目录
cd "$(dirname "$0")"

# 检查Docker是否运行
if ! docker info > /dev/null 2>&1; then
    echo "❌ 错误：Docker未运行，请先启动Docker"
    exit 1
fi

# 使用docker-compose启动服务
echo "正在启动MySQL和phpMyAdmin服务..."
docker-compose up -d

# 等待服务启动
echo "等待服务启动..."
sleep 10

# 显示服务状态
echo ""
echo "检查服务状态："
docker-compose ps

echo ""
echo "✅ 服务启动完成！"
echo ""
echo "📊 MySQL连接信息："
echo "  主机: localhost"
echo "  端口: 3306"
echo "  数据库: quantitative_advanced"
echo "  用户名: quantitative_user"
echo "  密码: quantitative_password"
echo ""
echo "🌐 phpMyAdmin管理界面："
echo "  URL: http://localhost:8080"
echo "  用户名: root"
echo "  密码: quantitative_password"
echo ""
